
import LoadAble from "../hoc/LoadAble";

const routes = [
  {
    path: '/redux',
    title: 'redux',
    component: LoadAble(() => import("../views/redux/ReduxPage")),
  },
  {
    path: '/react-redux',
    title: 'react-redux',
    component: LoadAble(() => import("../views/reactRedux/ReactRedux")),
  },
  {
    path: '/consPage',
    title: '拖拽组件',
    component: LoadAble(() => import('../views/consPage/consPage'))
  },
  {
    path: '/corssPage',
    title: '学生管理',
    component: LoadAble(() => import('../views/corssPage/corssPage')),
  },
  {
    path: '/modal',
    title: '封装模态框',
    component: LoadAble(() => import('../views/ModalPage/modalPage')),
  },
  {
    path: '/home',
    title: '快递信息',
    component: LoadAble(() => import("../views/home/EmsHome")),
    children: [
      {
        path: '/home/ems',
        title: '我要寄件',
        component: LoadAble(() => import("../views/home/Ems")),
      },
      {
        path: '/home/ems-info/:id',
        title: '快递信息',
        component: LoadAble(() => import("../views/home/EmsInfo")),
      },
      /*重定向要放在最后去写*/
      {
        from: '/home',
        redirect: '/home/ems'
      },

    ]
  },
  {
    path: '/echart',
    title: 'eChart案例',
    component: LoadAble(() => import("../views/EChartDemo/EChartDemo")),
  },
  {
    path: '/wenzhang',
    title: '文章列表',
    component: LoadAble(() => import("../views/wenzhang/WenZhang")),
  },
  {
    path: '/baiduMap',
    title: '百度地图',
    component: LoadAble(() => import("../views/map/baiduMap")),
  },
  {
    path: '/login',
    component: LoadAble(() => import("../views/login/login")),
  },
  {
    path: '/hoc',
    title: '高阶组件',
    component: LoadAble(() => import("../views/hocPage/hocIndex")),
    children: [
      {
        path: '/hoc/proxy',
        title: '高阶组件代理',
        component: LoadAble(() => import("../views/hocPage/HocTest1")),
      },
      {
        path: '/hoc/extends',
        title: '高阶组件继承',
        component: LoadAble(() => import("../views/hocPage/HocTest2")),
      },
      {
        from: '/hoc',
        redirect: '/hoc/proxy'
      },
    ]
  },
  {
    path: '/antd',
    title: 'ant-Design',
    component: LoadAble(() => import("../views/antd/antdPage")),
  }, {
    path: '/axios',
    title: 'axios',
    component: LoadAble(() => import("../views/axios/axiosPage")),
  },
  {
    path: '/detail/:id',
    component: LoadAble(() => import("../views/wenzhang/WenZhangDetail")),
  },
  {
    path: '/zhoukao2/system',
    title: '系统设置',
    component: LoadAble(() => import("../views/zhoukao2/System")),
  },

  {
    from: '/',
    redirect: '/system'
  }
];

export function getNavData(routerArr) {
  return routerArr.filter(item => item.title).map(key => {
    return {
      title: key.title,
      path: key.path,
      children: key.children
    }
  })
}

export default routes
